--剑雨滂沱
local jianyupangtuo = fk.CreateSkill {
    name = "mcdh_jianyupangtuo",
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

jianyupangtuo:addEffect('active',{
    card_num = 1,
    card_min_num = 1 ,
    target_num = 1,
    target_min_num = 1 ,
    can_use = function(self, player)
        return player:usedSkillTimes(self.name) == 0
    end,
    card_filter = function() return true end,
    target_filter = function(self, player,to_select, selected, selected_cards, card)
        return #selected == 0 and to_select ~= player
    end,
    on_use = function(self, room, effect)
        local target = effect.tos[1]
        local player = effect.from
        local type = Fk:getCardById(effect.cards[1]).type
        room:throwCard(effect.cards,self.name,player,player)
        player:drawCards(1,self.name)
        local re = {}
        for _,id in ipairs(target:getCardIds("h")) do
            if Fk:getCardById(id).type == type then
                table.insertIfNeed(re,id)
            end
        end
        if #re > 0  then
            room:recastCard(re, target, self.name)
        else
            room:useVirtualCard("slash", nil, player, target, self.name, false)
        end
    end
})

Fk:loadTranslationTable {
    ["mcdh_jianyupangtuo"] = "剑雨滂沱",
    [":mcdh_jianyupangtuo"] = "出牌阶段限一次，你可以弃置一张牌并摸一张牌，令一名其他角色展示手牌并重铸其中与你弃置牌类型相同的牌，若其未重铸牌，你对其视为使用一张【杀】。",
}

return jianyupangtuo